package com.hidt.shop.service.impl;

import com.hidt.shop.domain.Order_item;
import com.hidt.shop.mapper.Order_itemMapper;
import com.hidt.shop.service.Order_itemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Fhy
 * @Title Order_itemServiceImpl
 * @Package com.hdit.shop.service.impl
 * @Description 订单详情的业务处理实现类
 * @date 2021/1/21 19:56
 */
@Service
public class Order_itemServiceImpl implements Order_itemService {
    @Autowired
    private Order_itemMapper order_itemMapper;

    /**
     * 方法描述: 添加订单详情，需要先生成订单id
     * @author Fhy
     * @Date 2021/1/21 20:10
     * @params [order_item]
     * @return int
     */

    @Override
    public int addOrder_item(Order_item order_item) {
        int i = order_itemMapper.addOrder_item(order_item);
        return i;
    }

    /**
     * 方法描述: 通过订单表的订单号，
     *      删除对应的订单详情
     * @author Fhy
     * @Date 2021/1/21 20:10
     * @params [order_id]
     * @return int
     */
    @Override
    public int deleteOrder_item(String order_id) {
        int i = order_itemMapper.deleteOrder_item(order_id);
        return i;
    }

    /**
     * 方法描述: 过订单id查找所有订单详情数据
     * @author Fhy
     * @Date 2021/1/21 20:10
     * @params [order_id]
     * @return java.util.List<com.hidt.shop.domain.Order_item>
     */
    @Override
    public List<Order_item> findOrderItemByOrderId(String order_id) {
        List<Order_item> orderItemList = order_itemMapper.findOrderItemByOrderId(order_id);
        return orderItemList;
    }
}
